package com.prs.crm.action.sale.flow;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.ui.PaginationSupport;

import com.prs.crm.action.FlowAction;
import com.prs.crm.annotation.Clew;
import com.prs.crm.context.AppContext;
import com.prs.crm.domain.sale.SalesShipping;
import com.prs.crm.service.sale.SalesShippingService;

public class SalesShippingFlowAction extends FlowAction<SalesShipping> {

	private SalesShipping salesShipping;
	private SalesShippingService salesShippingService;	
	private PaginationSupport pagination;
	
	
	@Action("listSalesShippingFlow")
	public String listSalesShippingFlow() {
		pagination = this.getPaginationHelper().prepare(pagination);
		pagination = this.getSalesShippingService().listFlowTask(SalesShipping.class, pagination, AppContext.getAccountContext().currentUser());
		return SUCCESS;
	}
	
	@Action("editSalesShippingFlow")
	public String editSalesShippingFlow() {
		this.displayEndNodes();		
		return SUCCESS;
	}
	
	@Clew(results={"success"})
	@Action(value="submitSalesShippingFlow",results={@Result(name="success",type="redirect",location="listSalesShippingFlow")})
	public String submitSalesShippingFlow() {
		this.getSalesShippingService().execute(this.getNode(), this.getDetail(), salesShipping, AppContext.getAccountContext().currentUser());
		this.setPrompt("提交成功");
		return SUCCESS;
	}

	public SalesShipping getSalesShipping() {
		return salesShipping;
	}

	public void setSalesShipping(SalesShipping salesShipping) {
		this.salesShipping = salesShipping;
	}

	public SalesShippingService getSalesShippingService() {
		return salesShippingService;
	}

	public void setSalesShippingService(SalesShippingService salesShippingService) {
		this.salesShippingService = salesShippingService;
	}

	public PaginationSupport getPagination() {
		return pagination;
	}

	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}

}
